
angular
    .module('app.service')
    .service('MarkerService', MarkerService);

MarkerService.$inject = ['$http','API'];
function MarkerService($http,API) {
    var baseUrl = API+'markers';
    this.get = get;
    this.list = list;
    this.questionStat = questionStat;
    this.levelStat = levelStat;

    ////////////////
    function get(markerId){
        var url = baseUrl+'/'+markerId;
        return $http.get(url);
    }

    function list(workId, subject, stage) {
        var params = '?workId='+workId+'&subject='+subject+'&markStage='+stage;
        return $http.get(baseUrl+params);
    }

    function questionStat(markerId){
        var url = baseUrl+'/'+markerId+'/stat/questions';
        return $http.get(url);
    }

    function levelStat(markerId,questionId) {
        var url = baseUrl+'/'+markerId+'/stat/levels?questionId='+questionId;
        return $http.get(url);
    }
}